package com.hzdl.cinema.dao.impl;

import com.hzdl.cinema.dao.SeatDao;
import com.hzdl.cinema.domain.Seat;
import com.hzdl.cinema.util.JDBCUtils;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;

public class SeatDaoImpl implements SeatDao {

    JdbcTemplate jdbcTemplate = new JdbcTemplate(JDBCUtils.getDataSource());

    @Override
    public Seat findMySeat(Integer seatId) {
        String sql="select * from seat where seat_Id=?";
        Seat seat = jdbcTemplate.queryForObject(sql, new BeanPropertyRowMapper<>(Seat.class), seatId);
        return seat;
    }
}
